package com.aloda.controller;

import com.aloda.pojo.entity.Book;
import com.aloda.pojo.result.Result;
import com.aloda.service.BookService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author aloda
 * @description 针对book的数据库操作Controller实现
 * @createDate 2024-11-14
 */
@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookService bookService;

    @GetMapping("/{id}")
    public Result<Book> queryBook(@PathVariable Integer id) {
        Book book = bookService.selectBookById(id);
        return Result.success(book);
    }
}
